﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>管理后台</title>
    <link rel="stylesheet" href="../../../static/admin/layui/css/layui.css" media="all"/>
    <link rel="stylesheet/less" href="../../../static/admin/css/index.less"/>
    <link rel="stylesheet" href="../../../static/admin/css/jquery.pagination.css"/>
    <script src="../../../static/admin/js/jquery-1.12.3.js"></script>
    <script src="../../../static/admin/layui/layui.js"></script>
    <script src="../../../static/admin/js/less.min.js"></script>
    <script src="../../../static/admin/js/jquery.pagination.min.js"></script>
    <script src="../../../static/layer/layer.js"></script>
</head>
<style>
    .content img {
        width: 3rem;
    }

    img:hover {
        transform: scale(2, 2);
        transition: .5s transform;
    }
</style>

<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    {% include "/admin/left.html" %}

    <div class="layui-body">
        <div id="box" class="fl">
            <div class="content">
                <h3>用户分享列表</h3>
                <div class="search">
                    <label>用户搜索：</label><input style="width: 220px;" value="" class="name" id="uid" type="text" placeholder="请输入uid或手机号码"/>
                    <label style="margin-left: 1%;">开始日期：</label><input autocomplete="off" value="" name="stime" type="text" class="demo-input" placeholder="请选择开始日期" id="test1">
                    <label style="margin-left: 1%;">结束日期：</label><input autocomplete="off" value="" name="etime" type="text" class="demo-input" placeholder="请选择结束日期" id="test2">
                    <button onclick="get_data(1)" class="s_button">搜索</button>
                </div>

                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <thead>
                    <tr>
                        <th>分享ID</th>
                        <th>UID</th>
                        <th>手机号</th>
                        <th>分享标题</th>
                        <th>分享时间</th>
                        <th>分享类型</th>
                        <th>精确定位次数</th>
                        <th>模糊定位次数</th>
                        <th>最近定位时间</th>
                    </tr>
                    </tbody>
                    <tbody id="result">
                    </tbody>
                </table>
            </div>
            <div id="pagination1" class="page fr" style="margin-right: 1%;">
                <div class="ui-pagination-container">
                </div>
            </div>
        </div>
        <div class="layui-clear"></div>
    </div>
</div>
<input type="hidden" value="1" id="p">
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;

    });
</script>
</body>

</html>
<script src="../../../static/admin/laydate/laydate.js"></script>
<script>

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //常规用法
        laydate.render({
            elem: '#test1'
        });

        laydate.render({
            elem: '#test2'
        });
    })


</script>
<script>
    get_data(1);
    function get_data(p){
        var uid = $('#uid').val();
        var stime = $('#test1').val();
        var etime = $('#test2').val();
        $.ajax({
            url:"/admin/user_share_post",
            type:"post",
            data:{
                'p':p,
                'uid':uid,
                'stime':stime,
                'etime':etime
            },
            dataType:"json",
            success:function(msg){
                var q = '';
                if (msg.status == 1){
                    for (var i = 0; i < msg.res.length; i++){
                        q += '<tr>';
                        q += '<td>' + msg.res[i].locateId + '</td>';
                        q += '<td>' + msg.res[i].uid + '</td>';
                        q += '<td>' + msg.res[i].phone + '</td>';
                        q += '<td>' + msg.res[i].nickname + '</td>';
                        q += '<td>' + msg.res[i].addTime + '</td>';
                        q += '<td>' + msg.res[i].locateType + '</td>';
                        q += '<td>' + msg.res[i].locateNum + '</td>';
                        q += '<td>' + msg.res[i].blurNum + '</td>';
                        q += '<td>' + msg.res[i].newTime + '</td>';
                        q += '</tr>';
                    }
                }else {
                    q += '<tr><td colspan="9">暂无数据</td></tr>';
                }
                $('#result').html(q);
                $('.ui-pagination-container').html(msg.page);
                $('#p').val(msg.p);
            }
        })
    }
    function btn_fb(uid, status){
        if (status == 0){
            var content = "确定禁用";
        }else if(status == 1){
            var content = "确定启用";
        }else {
            var content = "确定删除";
        }
        layer.open({
            content: content,
            btn: ['确定', '取消'],
            shadeClose: false,
            yes: function () {
                $.ajax({
                    type: 'post',
                    url: '/admin/update_user_status_post',
                    data: {
                        uid : uid,
                        status : status
                    },
                    success: function (msg) {
                        if (msg.status == 1) {
                            layer.msg("操作成功", {time: 2000}, function () {
                                get_data($('#p').val());
                            });
                        } else {
                            layer.msg("操作失败", {time:1200})
                        }
                    }
                });
            }
        })
    }


</script>
